security: CWE-295: warn on TLS verify=False, fix insecure examples — VC-53768#195
Open
SahilWikhe-sw wants to merge 1 commit into
Open
security: CWE-295: warn on TLS verify=False, fix insecure examples — VC-53768#195SahilWikhe-sw wants to merge 1 commit into
SahilWikhe-sw wants to merge 1 commit into
Conversation
…-bundle default VC-53768
9033630 to
3a4a8be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
log.warninginTPPConnection,TPPTokenConnection, andCloudConnectionconstructors whenhttp_request_kwargs['verify'] is Falseverify="/path-to/bundle.pem") is the active line andverify=Falseis relegated to a clearly-labelled lab-only commentFinding
CWE-295 (Improper Certificate Validation) / CWE-1188 (Insecure Default)
All three connection classes (
connection_tpp.py,connection_tpp_token.py,connection_cloud.py) splatted**self._http_request_kwargsinto everyrequestscall with no guard on theverifykey. Four shipped examples (examples/get_cert.py,examples/tpp/get_cert_tpp_token.py,examples/ssh_certificates/get_cert_ssh.py,examples/ssh_certificates/get_cert_ssh_service.py) setverify=Falseas the active code path, so consumers copying them verbatim sent Venafi credentials, session tokens, and private-key material over TLS sessions with no server-certificate validation.Remediation
http_request_kwargs.get('verify') is Falseand emit aWARNING-level log message. Usesis Falseso CA-bundle strings and the absent-key default (None) are not flagged.verify=Falseis moved to a# Lab/testing only — DO NOT use in productioncomment.Verification
python -m py_compilepasses on all modified fileshttp_request_kwargs.get('verify') is Falseis branch-free and evaluated immediately after the dict is guaranteed non-NoneModuleNotFoundError: No module named 'six') are an unrelated environment issue unaffected by this change